<template>
    <el-container>
        <el-header id="manageHeader" height="80px" style="background-color:slategray">
            <!-- 搜索表单 -->
            <el-form :inline="true" :model="searchBase" class="demo-form-inline" style="margin-top: 1.5%;">
                <el-form-item label="教师号">
                    <el-input v-model="searchBase.teacherid" placeholder="教师号" style="width: 160px;">
                    </el-input>
                </el-form-item>
                <el-form-item label="姓名">
                    <el-input v-model="searchBase.teacherName" placeholder="姓名" style="width: 160px;">
                    </el-input>
                </el-form-item>
                <el-form-item label="职称">
                    <el-select v-model="value" style="width:90px" placeholder="请选择">
                        <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="onSubmit">查询</el-button>
                </el-form-item>
                <!-- 导出数据为Excel-->
                <!-- <el-form-item>
                    <el-button type="primary">导出Excel</el-button>
                </el-form-item> -->
            </el-form>
        </el-header>
        <el-main>

            <!--教师表格-->
            <template>
                <el-table :data="teacherinfo" style="width: 100%" @selection-change="handleSelectionChange">
                    <el-table-column type="selection" width="55">
                    </el-table-column>
                    <el-table-column prop="teacherid" label="教师号" align="center" width="80px">
                    </el-table-column>

                    <el-table-column prop="teacherName" label="姓名" align="center" width="80px">
                    </el-table-column>
                    <el-table-column prop="sex" label="性别" align="center" width="60px">
                    </el-table-column>
                    <el-table-column prop="title" label="职称" align="center" width="100px">
                    </el-table-column>
                    <el-table-column prop="education" label="学位" align="center" width="80px">
                    </el-table-column>
                    <el-table-column prop="tel" label="手机号" align="center" width="130px">
                    </el-table-column>
                    <el-table-column prop="mail" label="邮箱" align="center" width="180px">
                    </el-table-column>
                    <el-table-column prop="title" label="职称" align="center" width="80px">
                    </el-table-column>
                    <el-table-column align="center" label="操作">
                        <template slot-scope="scope">
                            <!-- <el-button type="primary" @click="showUpdate(scope.row)">修改</el-button> -->
                            <el-button type="danger" @click="deleteById(scope.row)">删除</el-button>
                            <el-button type="success" @click="showTeacherDetail(scope.row)">详情</el-button>
                        </template>
                    </el-table-column>
                </el-table>
            </template>
            <!-- 详情 带上修改-->
            <el-dialog title="教师基本信息" :visible.sync="dialogTeacherDetailVisible" width="90%"
                :close-on-click-modal="false">

                <!-- 卡片式查看教师信息 -->
                <el-tabs type="card" tab-position="top" height="550" ref="watchTeacherDetail">
                    <el-tab-pane label="教师基本信息">
                        <!-- div里存放基本信息 -->
                        <div id="teacherDetailList" ref="teacherDetailList">
                            <el-descriptions class="margin-top" title="教师基本信息" :column="3" border>

                                <el-descriptions-item label="教师号">{{ teacherBaseDetail.teacherid }}
                                </el-descriptions-item>
                                <el-descriptions-item>
                                    <template slot="label">
                                        <i class="el-icon-user"></i> 姓名 </template>
                                    {{teacherBaseDetail.teacherName}}
                                </el-descriptions-item>
                                <el-descriptions-item label="性别">{{ teacherBaseDetail.sex }}
                                </el-descriptions-item>
                                <el-descriptions-item label="出生日期">{{ teacherBaseDetail.birth }}
                                </el-descriptions-item>
                                <el-descriptions-item label="民族">{{ teacherBaseDetail.nation }}
                                </el-descriptions-item>
                                <el-descriptions-item label="身份证件号">{{ teacherBaseDetail.numberID }}
                                </el-descriptions-item>
                                <el-descriptions-item>
                                    <template slot="label">
                                        <i class="el-icon-location-outline"></i> 籍贯 </template>
                                    {{teacherBaseDetail.place}}
                                </el-descriptions-item>
                                <el-descriptions-item label="政治面貌">{{ teacherBaseDetail.polstatus }}
                                </el-descriptions-item>
                                <el-descriptions-item label="研究生导师">{{ teacherBaseDetail.tutor }}
                                </el-descriptions-item>
                                <el-descriptions-item label="教育背景">{{ teacherBaseDetail.education }}
                                </el-descriptions-item>
                                <el-descriptions-item label="婚姻状况">{{ teacherBaseDetail.marriage }}
                                </el-descriptions-item>
                                <el-descriptions-item label="入职时间">{{ teacherBaseDetail.entryTime }}
                                </el-descriptions-item>
                                <el-descriptions-item label="职称">{{ teacherBaseDetail.professionDrgree }}
                                </el-descriptions-item>
                                <el-descriptions-item>
                                    <template slot="label">
                                        <i class="el-icon-phone-outline"></i> 电话 </template>
                                    {{teacherBaseDetail.tel}}
                                </el-descriptions-item>
                                <el-descriptions-item label="电子邮箱">{{ teacherBaseDetail.mail }}
                                </el-descriptions-item>
                                <el-descriptions-item label="人员状态">{{ teacherBaseDetail.status }}
                                </el-descriptions-item>
                                <el-descriptions-item label="密码">{{ teacherBaseDetail.password }}
                                </el-descriptions-item>
                            </el-descriptions>
                        </div>

                    </el-tab-pane>
                    <el-tab-pane label="教师拓展信息">
                        <el-tabs v-model="activeName" @tab-click="handleClick">
                            <el-tab-pane label="教育背景" name="first" v-if="departmentName =='教务处'">
                                <div id="teacherDetailList" ref="teacherDetailList">
                                    <el-descriptions class="margin-top" :column="3" border>

                                        <el-descriptions-item label="就读时间">{{ teacherBaseDetail.beginTime }}
                                        </el-descriptions-item>

                                        <el-descriptions-item label="毕业时间">{{ teacherBaseDetail.endTime }}
                                        </el-descriptions-item>
                                        <el-descriptions-item label="毕业院校">{{ teacherBaseDetail.graduationSchool }}
                                        </el-descriptions-item>
                                        <el-descriptions-item label="所修专业">{{ teacherBaseDetail.speciality }}
                                        </el-descriptions-item>
                                    </el-descriptions>
                                </div>
                            </el-tab-pane>
                            <el-tab-pane label="教学工作" name="tewfw" v-if="departmentName =='教务处'">
                                <div id="teacherDetailList" v-for="mlist in Teach_workList" :key="mlist.index"
                                    ref="teacherDetailList">

                                    <el-button type="primary" style="float:right" size="small"
                                        @click="updateTeach_work(mlist)">编辑
                                    </el-button>

                                    <el-descriptions class="margin-top" :title="`学院:${mlist.faculty}`" :column="3"
                                        border>
                                        <el-descriptions-item label="学期">{{ mlist.term }}
                                        </el-descriptions-item>
                                        <el-descriptions-item label="课程名称">{{ mlist.courseName }}
                                        </el-descriptions-item>
                                        <el-descriptions-item label="授课班级">{{ mlist.Classname }}
                                        </el-descriptions-item>
                                        <el-descriptions-item label="授课时数">{{ mlist.teachHour }}
                                        </el-descriptions-item>
                                        <el-descriptions-item label="课程学分">{{ mlist.credit }}
                                        </el-descriptions-item>
                                    </el-descriptions>
                                </div>
                            </el-tab-pane>
                            <!-- 教学工作修改的弹窗界面 -->
                            <el-dialog title="教学工作修改" :visible.sync="dialogUpdate_teach_work" width="50%"
                                :close-on-click-modal="false" append-to-body>
                                <el-form :model="teach_workUpdate" label-width="100px" :inline="true">
                                    <el-form-item label="学期" prop="teacherName">
                                        <el-input v-model="teach_workUpdate.term" style="width:80%" clearable>
                                        </el-input>
                                    </el-form-item>

                                    <el-form-item label="课程名称" prop="numberId">
                                        <el-input v-model="teach_workUpdate.courseName" clearable style="width:80%">
                                        </el-input>
                                    </el-form-item>
                                    <el-form-item label="授课班级" prop="place">
                                        <el-input v-model="teach_workUpdate.Classname" clearable style="width:200px">
                                        </el-input>
                                    </el-form-item>
                                    <el-form-item label="授课时数" prop="polstatus">
                                        <el-input v-model="teach_workUpdate.teachHour" clearable style="width:200px">
                                        </el-input>
                                    </el-form-item>
                                    <el-form-item label="课程学分">
                                        <el-input v-model="teach_workUpdate.credit" clearable style="width:250px">
                                        </el-input>
                                    </el-form-item>
                                    <el-form-item>
                                        <el-button type="primary" @click="saveTeach_work">保存</el-button>
                                    </el-form-item>
                                </el-form>
                            </el-dialog>

                            <el-tab-pane label="年度考核" name="third" v-if="departmentName =='教务处'">
                                <div id="teacherDetailList" v-for="mlist in Annual_examinationList" :key="mlist.index"
                                    ref="teacherDetailList">
                                    <el-button type="primary" style="float:right" size="small"
                                        @click="updateAnnual_exam(mlist)">编辑
                                    </el-button>
                                    <el-descriptions class="margin-top" :title="`编号:${mlist.checkNO}`" :column="3"
                                        border>

                                        <el-descriptions-item label="考核项目">{{ mlist.checkName }}
                                        </el-descriptions-item>

                                        <el-descriptions-item label="考核结果">{{ mlist.checkResult }}
                                        </el-descriptions-item>
                                        <el-descriptions-item label="考核时间">{{ mlist.checkDate}}
                                        </el-descriptions-item>
                                        <el-descriptions-item label="考核年份">{{ mlist.checkYear }}
                                        </el-descriptions-item>

                                    </el-descriptions>
                                </div>
                            </el-tab-pane>
                            <!-- 年度考核修改的弹窗界面 -->
                            <el-dialog title="年度考核修改" :visible.sync="dialogUpdate_annual_exam" width="50%"
                                :close-on-click-modal="false" append-to-body>
                                <el-form :model="annual_exam_Update" label-width="100px" :inline="true">
                                    <el-form-item label="考核项目" prop="teacherName">
                                        <el-input v-model="annual_exam_Update.checkName" style="width:80%" clearable>
                                        </el-input>
                                    </el-form-item>

                                    <el-form-item label="考核结果" prop="numberId">
                                        <el-input v-model="annual_exam_Update.checkResult" clearable style="width:80%">
                                        </el-input>
                                    </el-form-item>
                                    <el-form-item label="考核时间" prop="place">
                                        <el-input v-model="annual_exam_Update.checkDate" clearable style="width:200px">
                                        </el-input>
                                    </el-form-item>
                                    <el-form-item label="考核年份" prop="polstatus">
                                        <el-input v-model="annual_exam_Update.checkYear" clearable style="width:200px">
                                        </el-input>
                                    </el-form-item>

                                    <el-form-item>
                                        <el-button type="primary" @click="saveAnnual_exam">保存</el-button>
                                    </el-form-item>
                                </el-form>
                            </el-dialog>
                            <el-tab-pane label="科研获奖情况" name="fourth" v-if="departmentName =='科研部门'">
                                <div id="teacherDetailList" v-for="mlist in AwardList" :key="mlist.index"
                                    ref="teacherDetailList">
                                    <el-button type="primary" style="float:right" size="small"
                                        @click="updateAward(mlist)">编辑
                                    </el-button>
                                    <el-descriptions class="margin-top" :title="`编号:${mlist.awardNO}`" :column="3"
                                        border>

                                        <el-descriptions-item label="获奖时间">{{ mlist.awardTime }}
                                        </el-descriptions-item>

                                        <el-descriptions-item label="获奖名称">{{ mlist.awardName }}
                                        </el-descriptions-item>
                                        <el-descriptions-item label="授予单位">{{ mlist.awardIns }}
                                        </el-descriptions-item>
                                        <el-descriptions-item label="奖项级别">{{ mlist.awardLevel }}
                                        </el-descriptions-item>
                                        <el-descriptions-item label="获奖证书">{{ mlist.awardEnclosure }}
                                        </el-descriptions-item>
                                    </el-descriptions>
                                </div>
                            </el-tab-pane>
                            <!-- 科研获奖的弹窗界面 -->
                            <el-dialog title="科研获奖情况修改" :visible.sync="dialogUpdate_award" width="50%"
                                :close-on-click-modal="false" append-to-body>
                                <el-form :model="award_Update" label-width="100px" :inline="true">
                                    <el-form-item label="获奖时间" prop="teacherName">
                                        <el-input v-model="award_Update.awardTime" style="width:80%" clearable>
                                        </el-input>
                                    </el-form-item>

                                    <el-form-item label="获奖名称">
                                        <el-input v-model="award_Update.awardName" clearable style="width:80%">
                                        </el-input>
                                    </el-form-item>

                                    <el-form-item label="授予单位">
                                        <el-input v-model="award_Update.awardIns" clearable style="width:200px">
                                        </el-input>
                                    </el-form-item>
                                    <el-form-item label="奖项级别">
                                        <el-input v-model="award_Update.awardLevel" clearable style="width:200px">
                                        </el-input>
                                    </el-form-item>
                                    <el-form-item label="获奖证书">
                                        <el-input v-model="award_Update.awardEnclosure" clearable style="width:200px">
                                        </el-input>
                                    </el-form-item>
                                    <el-form-item>
                                        <el-button type="primary" @click="saveAward">保存</el-button>
                                    </el-form-item>
                                </el-form>
                            </el-dialog>

                            <el-tab-pane label="科研情况" name="fifth" v-if="departmentName =='科研部门'">
                                <div id="teacherDetailList" v-for="mlist in Research_projectList" :key="mlist.index"
                                    ref="teacherDetailList">
                                    <el-button type="primary" style="float:right" size="small"
                                        @click="updateResearch(mlist)">编辑
                                    </el-button>
                                    <el-descriptions class="margin-top" :title="`编号:${mlist.projectNO}`" :column="3"
                                        border>

                                        <el-descriptions-item label="项目名">{{ mlist.projectName }}
                                        </el-descriptions-item>

                                        <el-descriptions-item label="项目经费">{{ mlist.projectFund }}
                                        </el-descriptions-item>
                                        <el-descriptions-item label="参与人员">{{ mlist.projectperson }}
                                        </el-descriptions-item>
                                        <el-descriptions-item label="科研方向">{{ mlist.projectDir }}
                                        </el-descriptions-item>
                                        <!-- <el-descriptions-item label="附件">{{ mlist.awardEnclosure }}
                    </el-descriptions-item> -->
                                    </el-descriptions>
                                </div>
                            </el-tab-pane>
                            <!-- 科研获奖的弹窗界面 -->
                            <el-dialog title="科研情况修改" :visible.sync="dialogUpdate_research" width="50%"
                                :close-on-click-modal="false" append-to-body>
                                <el-form :model="research_Update" label-width="100px" :inline="true">
                                    <el-form-item label="项目名" prop="teacherName">
                                        <el-input v-model="research_Update.projectName" style="width:80%" clearable>
                                        </el-input>
                                    </el-form-item>

                                    <el-form-item label="项目经费">
                                        <el-input v-model="research_Update.projectFund" clearable style="width:80%">
                                        </el-input>
                                    </el-form-item>

                                    <el-form-item label="参与人员">
                                        <el-input v-model="research_Update.projectperson" clearable style="width:200px">
                                        </el-input>
                                    </el-form-item>
                                    <el-form-item label="科研方向">
                                        <el-input v-model="research_Update.projectDir" clearable style="width:200px">
                                        </el-input>
                                    </el-form-item>

                                    <el-form-item>
                                        <el-button type="primary" @click="saveResearch">保存</el-button>
                                    </el-form-item>
                                </el-form>
                            </el-dialog>



                            <el-tab-pane label="荣誉称号" name="second" v-if="departmentName =='教师工作部'">
                                <div id="teacherDetailList" v-for="mlist in Honor_titleList" :key="mlist.index"
                                    ref="teacherDetailList">
                                    <el-button type="primary" style="float:right" size="small"
                                        @click="updateHonor(mlist)">编辑
                                    </el-button>
                                    <el-descriptions class="margin-top" :title="`编号:${mlist.honorNO}`" :column="3"
                                        border>

                                        <el-descriptions-item label="称号名称">{{ mlist.honorName }}
                                        </el-descriptions-item>

                                        <el-descriptions-item label="荣誉等级">{{ mlist.honorLevel }}
                                        </el-descriptions-item>
                                        <el-descriptions-item label="获取时间">{{ mlist.acquireTime }}
                                        </el-descriptions-item>
                                        <el-descriptions-item label="证书">{{ mlist.certificate }}
                                        </el-descriptions-item>
                                        <el-descriptions-item label="颁发部门">{{ mlist.Issuingdep }}
                                        </el-descriptions-item>

                                    </el-descriptions>
                                </div>
                            </el-tab-pane>
                            <!-- 荣誉称号的弹窗界面 -->
                            <el-dialog title="荣誉称号修改" :visible.sync="dialogUpdate_honor" width="50%"
                                :close-on-click-modal="false" append-to-body>
                                <el-form :model="honor_Update" label-width="100px" :inline="true">
                                    <el-form-item label="称号名称" prop="teacherName">
                                        <el-input v-model="honor_Update.honorName" style="width:80%" clearable>
                                        </el-input>
                                    </el-form-item>

                                    <el-form-item label="荣誉等级">
                                        <el-input v-model="honor_Update.honorLevel" clearable style="width:80%">
                                        </el-input>
                                    </el-form-item>

                                    <el-form-item label="获取时间">
                                        <el-input v-model="honor_Update.acquireTime" clearable style="width:200px">
                                        </el-input>
                                    </el-form-item>

                                    <el-form-item label="证书">
                                        <el-input v-model="honor_Update.certificate" clearable style="width:200px">
                                        </el-input>
                                    </el-form-item>
                                    <el-form-item label="颁发部门">
                                        <el-input v-model="honor_Update.Issuingdep" clearable style="width:200px">
                                        </el-input>
                                    </el-form-item>
                                    <el-form-item>
                                        <el-button type="primary" @click="saveHonor">保存</el-button>
                                    </el-form-item>
                                </el-form>
                            </el-dialog>
                            <el-tab-pane label="工作经历" name="elevant" v-if="departmentName =='教师工作部'">
                                <div id="teacherDetailList" v-for="mlist in WorkList" :key="mlist.index"
                                    ref="teacherDetailList">
                                    <el-button type="primary" style="float:right" size="small"
                                        @click="updateWork(mlist)">编辑
                                    </el-button>
                                    <el-descriptions class="margin-top" :title="`${mlist.workadd}`" :column="3" border>

                                        <el-descriptions-item label="就职日期">{{ mlist.intime }}
                                        </el-descriptions-item>

                                        <el-descriptions-item label="离职日期">{{ mlist.outtime }}
                                        </el-descriptions-item>

                                        <el-descriptions-item label="工作地点">{{ mlist.workadd }}
                                        </el-descriptions-item>
                                        <el-descriptions-item label="工作职位">{{ mlist.workposition }}
                                        </el-descriptions-item>
                                        <el-descriptions-item label="工作内容">{{ mlist.workcontent }}
                                        </el-descriptions-item>


                                    </el-descriptions>
                                </div>
                            </el-tab-pane>

                            <!-- 工作经历的弹窗界面 -->
                            <el-dialog title="工作经历修改" :visible.sync="dialogUpdate_work" width="50%"
                                :close-on-click-modal="false" append-to-body>
                                <el-form :model="work_Update" label-width="100px" :inline="true">
                                    <el-form-item label="就职日期">
                                        <el-input v-model="work_Update.intime" style="width:80%" clearable>
                                        </el-input>
                                    </el-form-item>

                                    <el-form-item label="离职日期">
                                        <el-input v-model="work_Update.outtime" clearable style="width:80%">
                                        </el-input>
                                    </el-form-item>

                                    <el-form-item label="工作地点">
                                        <el-input v-model="work_Update.workadd" clearable style="width:200px">
                                        </el-input>
                                    </el-form-item>
                                    <el-form-item label="工作职位">
                                        <el-input v-model="work_Update.workposition" clearable style="width:200px">
                                        </el-input>
                                    </el-form-item>
                                    <el-form-item label="工作内容">
                                        <el-input v-model="work_Update.workcontent" clearable style="width:200px">
                                        </el-input>
                                    </el-form-item>
                                    <el-form-item>
                                        <el-button type="primary" @click="saveWork">保存</el-button>
                                    </el-form-item>
                                </el-form>
                            </el-dialog>
                            <el-tab-pane label="论文情况" name="sixth" v-if="departmentName =='教师工作部'">
                                <div id="teacherDetailList" v-for="m in thesislist" :key="m.thesisNo"
                                    ref="teacherDetailList">
                                    <el-button type="primary" style="float:right" size="small" @click="updateThesis(m)">
                                        编辑
                                    </el-button>
                                    <el-descriptions class="margin-top" :title="`论文名:${m.thesisName}`" :column="3"
                                        border>

                                        <el-descriptions-item label="CN号">{{ m.thesisNO }}
                                        </el-descriptions-item>

                                        <el-descriptions-item label="论文名">{{ m.thesisName }}
                                        </el-descriptions-item>
                                        <el-descriptions-item label="发表时间">{{m.thesisDate }}
                                        </el-descriptions-item>
                                        <el-descriptions-item label="期刊类别">{{ m.thesisJour }}
                                        </el-descriptions-item>
                                        <el-descriptions-item label="论文类别">{{ m.category }}
                                        </el-descriptions-item>
                                        <el-descriptions-item label="第一作者">{{ m.thesisauthor }}
                                        </el-descriptions-item>
                                        <el-descriptions-item label="通讯作者">{{ m.thesisauthorTwo }}
                                        </el-descriptions-item>
                                        <el-descriptions-item label="附件">{{ m.thesisEnclosure }}
                                        </el-descriptions-item>
                                    </el-descriptions>
                                </div>
                            </el-tab-pane>

                            <!-- 论文情况的弹窗界面 -->
                            <el-dialog title="论文情况修改" :visible.sync="dialogUpdate_thesis" width="50%"
                                :close-on-click-modal="false" append-to-body>
                                <el-form :model="thesis_Update" label-width="100px" :inline="true">
                                    <!-- <el-form-item label="CN号">
                                        <el-input v-model="thesis_Update.thesisNO" style="width:80%" clearable>
                                        </el-input>
                                    </el-form-item> -->

                                    <el-form-item label="论文名">
                                        <el-input v-model="thesis_Update.thesisName" clearable style="width:80%">
                                        </el-input>
                                    </el-form-item>

                                    <el-form-item label="发表时间">
                                        <el-input v-model="thesis_Update.thesisDate" clearable style="width:200px">
                                        </el-input>
                                    </el-form-item>
                                    <el-form-item label="期刊类别">
                                        <el-input v-model="thesis_Update.thesisJour" clearable style="width:200px">
                                        </el-input>
                                    </el-form-item>
                                    <el-form-item label="第一作者">
                                        <el-input v-model="thesis_Update.thesisauthor" clearable style="width:200px">
                                        </el-input>
                                    </el-form-item>
                                    <el-form-item label="通讯作者">
                                        <el-input v-model="thesis_Update.thesisauthorTwo" clearable style="width:200px">
                                        </el-input>
                                    </el-form-item>
                                    <el-form-item label="附件">
                                        <el-input v-model="thesis_Update.thesisEnclosurer" clearable
                                            style="width:200px">
                                        </el-input>
                                    </el-form-item>
                                    <el-form-item>
                                        <el-button type="primary" @click="saveThesis">保存</el-button>
                                    </el-form-item>
                                </el-form>
                            </el-dialog>

                            <el-tab-pane label="著作情况" name="seventh" v-if="departmentName =='教师工作部'">
                                <div id="teacherDetailList" v-for="mlist in OpusList" :key="mlist.index"
                                    ref="teacherDetailList">
                                    <el-button type="primary" style="float:right" size="small"
                                        @click="updateOpus(mlist)">编辑
                                    </el-button>
                                    <el-descriptions class="margin-top" :title="`ISCN号:${mlist.opusNO}`" :column="3"
                                        border>

                                        <!-- <el-descriptions-item label="著作编号">{{ mlist.opusNO }}
                    </el-descriptions-item> -->

                                        <el-descriptions-item label="著作名">{{ mlist.opusName }}
                                        </el-descriptions-item>
                                        <el-descriptions-item label="出版社">{{ mlist.publicer }}
                                        </el-descriptions-item>
                                        <el-descriptions-item label="著作类别">{{ mlist.opuscategory }}
                                        </el-descriptions-item>
                                        <el-descriptions-item label="著作级别">{{ mlist.opuslevel }}
                                        </el-descriptions-item>
                                        <el-descriptions-item label="参与人员">{{ mlist.opusperson }}
                                        </el-descriptions-item>
                                        <el-descriptions-item label="著作详情">{{ mlist.opusdetail }}
                                        </el-descriptions-item>
                                        <el-descriptions-item label="附件">{{ mlist.opusEnclosure }}
                                        </el-descriptions-item>
                                    </el-descriptions>
                                </div>
                            </el-tab-pane>

                            <!-- 著作情况的弹窗界面 -->
                            <el-dialog title="著作情况修改" :visible.sync="dialogUpdate_opus" width="50%"
                                :close-on-click-modal="false" append-to-body>
                                <el-form :model="opus_Update" label-width="100px" :inline="true">
                                    <el-form-item label="著作名">
                                        <el-input v-model="opus_Update.opusName" style="width:80%" clearable>
                                        </el-input>
                                    </el-form-item>

                                    <el-form-item label="出版社">
                                        <el-input v-model="opus_Update.publicer" clearable style="width:80%">
                                        </el-input>
                                    </el-form-item>

                                    <el-form-item label="著作类别">
                                        <el-input v-model="opus_Update.opuscategory" clearable style="width:200px">
                                        </el-input>
                                    </el-form-item>
                                    <el-form-item label="著作级别">
                                        <el-input v-model="opus_Update.opuslevel" clearable style="width:200px">
                                        </el-input>
                                    </el-form-item>
                                    <el-form-item label="参与人员">
                                        <el-input v-model="opus_Update.opusperson" clearable style="width:200px">
                                        </el-input>
                                    </el-form-item>
                                    <el-form-item label="附件">
                                        <el-input v-model="opus_Update.opusEnclosure" clearable style="width:200px">
                                        </el-input>
                                    </el-form-item>

                                    <el-form-item>
                                        <el-button type="primary" @click="saveOpus">保存</el-button>
                                    </el-form-item>
                                </el-form>
                            </el-dialog>
                            <el-tab-pane label="专利情况" name="eighth" v-if="departmentName =='教师工作部'">
                                <div id="teacherDetailList" v-for="mlist in PatentList" :key="mlist.patentNO"
                                    ref="teacherDetailList">
                                    <el-button type="primary" style="float:right" size="small"
                                        @click="updatePatent(mlist)">编辑
                                    </el-button>
                                    <el-descriptions class="margin-top" :title="`专利号:${mlist.patentNO}`" :column="3"
                                        border>

                                        <!-- <el-descriptions-item label="专利号">{{ mlist.patentNO }}
                    </el-descriptions-item> -->

                                        <el-descriptions-item label="专利名称">{{ mlist.patentName }}
                                        </el-descriptions-item>

                                        <el-descriptions-item label="专利等级">{{ mlist.patentlevel }}
                                        </el-descriptions-item>
                                        <el-descriptions-item label="专利类别">{{ mlist.patenttype }}
                                        </el-descriptions-item>
                                        <el-descriptions-item label="专利说明">{{ mlist.patentexplain }}
                                        </el-descriptions-item>
                                        <el-descriptions-item label="有效时间">{{ mlist.validtime }}
                                        </el-descriptions-item>
                                        <el-descriptions-item label="附件">{{ mlist.patentEnclosure }}
                                        </el-descriptions-item>
                                    </el-descriptions>
                                </div>
                            </el-tab-pane>
                            <!-- 专利情况的弹窗界面 -->
                            <el-dialog title="专利情况修改" :visible.sync="dialogUpdate_patent" width="50%"
                                :close-on-click-modal="false" append-to-body>
                                <el-form :model="patent_Update" label-width="100px" :inline="true">
                                    <el-form-item label="专利名称">
                                        <el-input v-model="patent_Update.patentName" style="width:80%" clearable>
                                        </el-input>
                                    </el-form-item>

                                    <el-form-item label="专利等级">
                                        <el-input v-model="patent_Update.patentlevel" clearable style="width:80%">
                                        </el-input>
                                    </el-form-item>

                                    <el-form-item label="专利类别">
                                        <el-input v-model="patent_Update.patenttype" clearable style="width:200px">
                                        </el-input>
                                    </el-form-item>
                                    <el-form-item label="专利说明">
                                        <el-input v-model="patent_Update.patentexplain" clearable style="width:200px">
                                        </el-input>
                                    </el-form-item>
                                    <el-form-item label="有效时间">
                                        <el-input v-model="patent_Update.validtime" clearable style="width:200px">
                                        </el-input>
                                    </el-form-item>
                                    <el-form-item label="附件">
                                        <el-input v-model="patent_Update.patentEnclosure" clearable style="width:200px">
                                        </el-input>
                                    </el-form-item>
                                    <el-form-item>
                                        <el-button type="primary" @click="savePatent">保存</el-button>
                                    </el-form-item>
                                </el-form>
                            </el-dialog>

                            <el-tab-pane label="培训经历" name="ninth" v-if="departmentName =='教师工作部'">
                                <div id="teacherDetailList" v-for="mlist in TrainList" :key="mlist.index"
                                    ref="teacherDetailList">
                                    <el-button type="primary" style="float:right" size="small"
                                        @click="updateTrain(mlist)">编辑
                                    </el-button>
                                    <el-descriptions class="margin-top" :title="`编号:${mlist.trainNO}`" :column="3"
                                        border>

                                        <el-descriptions-item label="培训时间">{{ mlist.trainTime }}
                                        </el-descriptions-item>

                                        <el-descriptions-item label="培训地点">{{ mlist.trainadd }}
                                        </el-descriptions-item>

                                        <el-descriptions-item label="培训课题">{{ mlist.traintit }}
                                        </el-descriptions-item>
                                        <el-descriptions-item label="培训用书">{{ mlist.trainbook }}
                                        </el-descriptions-item>
                                        <el-descriptions-item label="培训单位">{{ mlist.trainposition }}
                                        </el-descriptions-item>
                                        <el-descriptions-item label="附件">{{ mlist.trainEnclosure }}
                                        </el-descriptions-item>

                                    </el-descriptions>
                                </div>
                            </el-tab-pane>
                            <!-- 培训经历的弹窗界面 -->
                            <el-dialog title="培训经历修改" :visible.sync="dialogUpdate_train" width="50%"
                                :close-on-click-modal="false" append-to-body>
                                <el-form :model="train_Update" label-width="100px" :inline="true">
                                    <el-form-item label="培训时间">
                                        <el-input v-model="train_Update.trainTime" style="width:80%" clearable>
                                        </el-input>
                                    </el-form-item>
                                    <el-form-item label="培训地点">
                                        <el-input v-model="train_Update.trainadd" clearable style="width:80%">
                                        </el-input>
                                    </el-form-item>

                                    <el-form-item label="培训课题">
                                        <el-input v-model="train_Update.traintit" clearable style="width:200px">
                                        </el-input>
                                    </el-form-item>
                                    <el-form-item label="培训用书">
                                        <el-input v-model="train_Update.trainbook" clearable style="width:200px">
                                        </el-input>
                                    </el-form-item>
                                    <el-form-item label="培训单位">
                                        <el-input v-model="train_Update.trainposition" clearable style="width:200px">
                                        </el-input>
                                    </el-form-item>
                                    <el-form-item label="附件">
                                        <el-input v-model="train_Update.trainEnclosure" clearable style="width:200px">
                                        </el-input>
                                    </el-form-item>
                                    <el-form-item>
                                        <el-button type="primary" @click="saveTrain">保存</el-button>
                                    </el-form-item>
                                </el-form>
                            </el-dialog>

                            <el-tab-pane label="研究生导师" v-if="teacherBaseDetail.tutor =='是' && departmentName=='教务处'"
                                name="tenth">
                                <div id="teacherDetailList" ref="teacherDetailList">
                                    <el-descriptions class="margin-top" title="具体信息" :column="3" border>

                                        <el-descriptions-item label="研究课题">{{ teacherBaseDetail.tutortitle }}
                                        </el-descriptions-item>

                                        <el-descriptions-item label="所属专业系">{{ teacherBaseDetail.specialize }}
                                        </el-descriptions-item>

                                        <el-descriptions-item label="研究方向">{{ teacherBaseDetail.researchdir }}
                                        </el-descriptions-item>
                                        <el-descriptions-item label="所带学生数">{{ teacherBaseDetail.stuNum }}
                                        </el-descriptions-item>
                                        <el-descriptions-item label="学位">{{ teacherBaseDetail.degree }}
                                        </el-descriptions-item>
                                        <el-descriptions-item label="邮箱">{{ teacherBaseDetail.email }}
                                        </el-descriptions-item>

                                    </el-descriptions>
                                </div>
                            </el-tab-pane>

                        </el-tabs>
                    </el-tab-pane>
                </el-tabs>
            </el-dialog>
            <!--分页工具条-->
            <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
                :current-page="currentPage" :page-sizes="[5, 10, 15, 20]" :page-size="5"
                layout="total, sizes, prev, pager, next, jumper" :total="totalCount ">
            </el-pagination>
        </el-main>
    </el-container>
</template>

<script>
import axios from "axios";

// 定义一条教师的信息


export default {
    name: "Depteacher",
    data() {
        return {
            // 接受学院的信息
            departmentName: '',
            // 搜索表单的数据
            searchBase: {
                teacherid: "",
                teacherName: "",
                title: "",
            },
            options: [{
                value: '讲师',
                label: '讲师'
            }, {
                value: '副教授',
                label: '副教授'
            }, {
                value: '教授',
                label: '教授'
            },{
                value: '',
                label: '无'
            }],
            value: '',
            // 教师的信息
            teacherinfo: [],
            //详情界面
            dialogTeacherDetailVisible: false,
            teacherBaseDetail: {},

            activeName: 'first',
            // 分页的属性
            totalCount: 0,
            pageSize: 5,
            totalCount: 0,
            //被选中的id
            selectedIds: [],
            // 当前页码
            currentPage: 1,
            // 获取后端审核的数据
            thesislist: [],
            Research_projectList: [],
            Annual_examinationList: [],
            AwardList: [],
            Honor_titleList: [],
            OpusList: [],
            Teach_workList: [],
            TrainList: [],
            PatentList: [],
            WorkList: [],
            // 部门教师修改的数据
            dialogUpdate_teach_work:false,
            teach_workUpdate:{},

            dialogUpdate_annual_exam:false,
            annual_exam_Update:{},

            dialogUpdate_award:false,
            award_Update:{},

            dialogUpdate_research:false,
            research_Update:{},

            dialogUpdate_honor:false,
            honor_Update:{},

            dialogUpdate_work:false,
            work_Update:{},
 
            dialogUpdate_thesis: false,
            thesis_Update:{},

            dialogUpdate_opus:false,
            opus_Update:{},

            dialogUpdate_patent:false,
            patent_Update:{},

            dialogUpdate_train:false,
            train_Update:{},
        }
    }, mounted() {
        this.departmentName = this.$route.query.mark
        this.selectinfo();
    },
    methods: {

        // 教学工作修改页面
        updateTeach_work(row){
            this.dialogUpdate_teach_work=true
            this.teach_workUpdate=row
        }, 
        //保存教师基本信息
        saveTeach_work() {
            this.$confirm('此操作将修改教学工作, 是否继续?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'success'
            }).then(() => {
                axios({
                    method: "post",
                    url: " http://localhost:8888/Teachersystem/depTeacher/UpdateTeach_work",
                    data: this.teach_workUpdate
                }).then(resp => {
                    if (resp.data == "ok") {
                        this.$message({
                            type: 'success',
                            message: '修改成功!'
                        });
                        this.dialogUpdate_teach_work = false;
                    }
                })
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: '已取消修改'
                });
            });
        },
        // 年度考核修改
        updateAnnual_exam(row){
           this.dialogUpdate_annual_exam=true
            this.annual_exam_Update=row
        },
        saveAnnual_exam() {
            this.$confirm('此操作将修改年度考核, 是否继续?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'success'
            }).then(() => {
                axios({
                    method: "post",
                    url: " http://localhost:8888/Teachersystem/depTeacher/UpdateAnnual_examination",
                    data: this.annual_exam_Update
                }).then(resp => {
                    if (resp.data == "ok") {
                        this.$message({
                            type: 'success',
                            message: '修改成功!'
                        });
                        this.dialogUpdate_annual_exam=false;
                    }
                })
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: '已取消修改'
                });
            });
        },
        // 科研获奖情况
        updateAward(row){
           this.dialogUpdate_award=true
            this.award_Update=row
        },
        saveAward() {
            this.$confirm('此操作将修改科研奖励, 是否继续?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'success'
            }).then(() => {
                axios({
                    method: "post",
                    url: " http://localhost:8888/Teachersystem/depTeacher/UpdateAward",
                    data: this.award_Update
                }).then(resp => {
                    if (resp.data == "ok") {
                        this.$message({
                            type: 'success',
                            message: '修改成功!'
                        });
                        this.dialogUpdate_award = false;
                    }
                })
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: '已取消修改'
                });
            });
        },
        // 科研情况
        updateResearch(row){
           this.dialogUpdate_research=true
            this.research_Update=row
        },
        saveResearch() {
            this.$confirm('此操作将修改研究内容, 是否继续?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'success'
            }).then(() => {
                axios({
                    method: "post",
                    url: " http://localhost:8888/Teachersystem/depTeacher/UpdateResearch_project",
                    data: this.research_Update
                }).then(resp => {
                    if (resp.data == "ok") {
                        this.$message({
                            type: 'success',
                            message: '修改成功!'
                        });
                        this.dialogUpdate_research = false;
                    }
                })
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: '已取消修改'
                });
            });
        },
        // 荣誉称号
        updateHonor(row){
           this.dialogUpdate_honor=true
           this.honor_Update=row
        },
        saveHonor() {
            this.$confirm('此操作将修改该荣誉, 是否继续?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'success'
            }).then(() => {
                axios({
                    method: "post",
                    url: " http://localhost:8888/Teachersystem/depTeacher/UpdateHonor",
                    data: this.honor_Update
                }).then(resp => {
                    if (resp.data == "ok") {
                        this.$message({
                            type: 'success',
                            message: '修改成功!'
                        });
                        this.dialogUpdate_honor = false;
                    }
                })
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: '已取消修改'
                });
            });
        },
        // 工作经历
        updateWork(row){
            this.dialogUpdate_work=true,
                this.work_Update=row
        },
        saveWork() {
            this.$confirm('此操作将修改改工作经历, 是否继续?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'success'
            }).then(() => {
                axios({
                    method: "post",
                    url: " http://localhost:8888/Teachersystem/depTeacher/UpdateWork",
                    data: this.work_Update
                }).then(resp => {
                    if (resp.data == "ok") {
                        this.$message({
                            type: 'success',
                            message: '修改成功!'
                        });
                        this.dialogUpdate_work = false;
                    }
                })
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: '已取消修改'
                });
            });
        },
        // 论文
        updateThesis(row){
            this.dialogUpdate_thesis=true,
                this.thesis_Update=row
        },
        saveThesis() {
            this.$confirm('此操作将修改论文, 是否继续?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'success'
            }).then(() => {
                axios({
                    method: "post",
                    url: " http://localhost:8888/Teachersystem/depTeacher/UpdateThesis",
                    data: this.thesis_Update
                }).then(resp => {
                    if (resp.data == "ok") {
                        this.$message({
                            type: 'success',
                            message: '修改成功!'
                        });
                        this.dialogUpdate_thesis = false;
                    }
                })
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: '已取消修改'
                });
            });
        },
        // 著作
        updateOpus(row){
            this.dialogUpdate_opus=true
                this.opus_Update=row
        },
        saveOpus() {
            this.$confirm('此操作将修改该著作, 是否继续?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'success'
            }).then(() => {
                axios({
                    method: "post",
                    url: " http://localhost:8888/Teachersystem/depTeacher/UpdateOpus",
                    data: this.opus_Update
                }).then(resp => {
                    if (resp.data == "ok") {
                        this.$message({
                            type: 'success',
                            message: '修改成功!'
                        });
                        this.dialogUpdate_opus = false;
                    }
                })
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: '已取消修改'
                });
            });
        },
      // 专利
        updatePatent(row){
               this. dialogUpdate_patent=true
                this.patent_Update=row
        },
        savePatent() {
            this.$confirm('此操作将修改该专利, 是否继续?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'success'
            }).then(() => {
                axios({
                    method: "post",
                    url: " http://localhost:8888/Teachersystem/depTeacher/UpdatePatent",
                    data: this.patent_Update
                }).then(resp => {
                    if (resp.data == "ok") {
                        this.$message({
                            type: 'success',
                            message: '修改成功!'
                        });
                        this.dialogUpdate_patent = false;
                    }
                })
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: '已取消修改'
                });
            });
        },
        // 培训
        updateTrain(row){
            this.dialogUpdate_train=true
                this.train_Update=row
        },
        saveTrain() {
            this.$confirm('此操作将修改改培训, 是否继续?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'success'
            }).then(() => {
                axios({
                    method: "post",
                    url: " http://localhost:8888/Teachersystem/depTeacher/UpdateTrain",
                    data: this.train_Update
                }).then(resp => {
                    if (resp.data == "ok") {
                        this.$message({
                            type: 'success',
                            message: '修改成功!'
                        });
                        this.dialogUpdate_train = false;
                    }
                })
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: '已取消修改'
                });
            });
        },
        //  获取后端列表的方法
        getThesis(id) {
            axios({
                method: "get",
                url: " http://localhost:8888/Teachersystem/Teacher/getThesisList?id=" + id,
            }).then(resp => {
                this.thesislist = resp.data;
            })
        },
        getResearch_project(id) {
            axios({
                method: "get",
                url: " http://localhost:8888/Teachersystem/Teacher/getResearch_project?id=" + id,
            }).then(resp => {
                this.Research_projectList = resp.data;
            })
        },
        getAnnual_examination(id) {
            axios({
                method: "get",
                url: " http://localhost:8888/Teachersystem/Teacher/getAnnual_examination?id=" + id,
            }).then(resp => {
                this.Annual_examinationList = resp.data;
            })
        },
        getAward(id) {
            axios({
                method: "get",
                url: " http://localhost:8888/Teachersystem/Teacher/getAward?id=" + id,
            }).then(resp => {
                this.AwardList = resp.data;
            })
        },
        getHonor_title(id) {
            axios({
                method: "get",
                url: " http://localhost:8888/Teachersystem/Teacher/getHonor_title?id=" + id,
            }).then(resp => {
                this.Honor_titleList = resp.data;
            })
        },
        getOpus(id) {
            axios({
                method: "get",
                url: " http://localhost:8888/Teachersystem/Teacher/getOpus?id=" + id,
            }).then(resp => {
                this.OpusList = resp.data;
            })
        },
        getTeach_work(id) {
            axios({
                method: "get",
                url: " http://localhost:8888/Teachersystem/Teacher/getTeach_work?id=" + id,
            }).then(resp => {
                this.Teach_workList = resp.data;
            })
        },
        getTrain(id) {
            axios({
                method: "get",
                url: " http://localhost:8888/Teachersystem/Teacher/getTrain?id=" + id,
            }).then(resp => {
                this.TrainList = resp.data;
            })
        },
        getPatent(id) {
            axios({
                method: "get",
                url: " http://localhost:8888/Teachersystem/Teacher/getPatent?id=" + id,
            }).then(resp => {
                this.PatentList = resp.data;
            })
        },
        getWork(id) {
            axios({
                method: "get",
                url: " http://localhost:8888/Teachersystem/Teacher/getWork?id=" + id,
            }).then(resp => {
                this.WorkList = resp.data;
            })
        },
        selectinfo() {
            // 获取后端需要审核的数据

            axios({
                method: "post",
                url: " http://localhost:8888/Teachersystem/depTeacher/selectByPageAndCondition?currentPage=" + this.currentPage + "&pageSize=" + this.pageSize,
                data: this.searchBase
            }).then(resp => {
                this.teacherinfo = resp.data.rows;
                this.totalCount = resp.data.totalCount;
            })
        },
        // 提交查询
        onSubmit() {
            this.searchBase.title=this.value
            this.selectinfo();
        },

        // 复选框选中后执行的方法
        handleSelectionChange(val) {
            this.multipleSelection = val;

            for (let i = 0; i < this.multipleSelection.length; i++) {
                this.selectedIds[i] = this.multipleSelection[i].id;
            }
        },
        //根据ID删除
        deleteById(row) {
            this.$confirm('此操作删除该教师, 是否继续?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {

                axios({
                    method: "get",
                    url: " http://localhost:8888/Teachersystem/depTeacher/delteacher?id=" + row.teacherid,
                }).then(resp => {
                    if (resp.data === "ok") {
                        this.$message({
                            message: '恭喜你，删除成功',
                            type: 'success'
                        });
                    }
                    this.selectinfo();
                })
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: '已取消删除'
                });
            });
        },
        //显示教师详细信息界面
        showTeacherDetail(row) {
            this.dialogTeacherDetailVisible = true;
            this.teacherBaseDetail = row;
            if (this.departmentName == '教务处') {
                this.getTeach_work(row.teacherid);
                this.getAnnual_examination(row.teacherid);
            } else if (this.departmentName == '科研部门') {
                this.getResearch_project(row.teacherid);
                this.getAward(row.teacherid);
            } else if (this.departmentName == '教师工作部') {
                this.getThesis(row.teacherid);
                this.getHonor_title(row.teacherid);
                this.getOpus(row.teacherid);
                this.getTrain(row.teacherid);
                this.getPatent(row.teacherid);
                this.getWork(row.teacherid);
            }
        },
        //显示修改界面
        changeteacherDetail() {
            this.$refs.teacherDetailList.style.display = "none";
            this.$refs.changeTeacherDetailList.style.display = "block";
        },
        handleClick(tab, event) {
            console.log(tab, event);
        },
      
        //分页
        handleSizeChange(val) {
            // console.log(`每页 ${val} 条`);
            this.pageSize = val;
            this.selectinfo();
        },
        handleCurrentChange(val) {
            // console.log(`当前页: ${val}`);
            this.currentPage = val;
            this.selectinfo();
        }
    },

}
</script>

<style>
</style>